<?php

/**
 * Usuario filter form base class.
 *
 * @package    sysdoc-v.1
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUsuarioFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_tipo_usuario'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoUsuario'), 'add_empty' => true)),
      'id_entidad'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Entidad'), 'add_empty' => true)),
      'nombre_usuario'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'ci_usuario'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'direccion'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'login'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'correo_electronico' => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'id_tipo_usuario'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TipoUsuario'), 'column' => 'id_tipo_usuario')),
      'id_entidad'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Entidad'), 'column' => 'id_entidad')),
      'nombre_usuario'     => new sfValidatorPass(array('required' => false)),
      'ci_usuario'         => new sfValidatorPass(array('required' => false)),
      'direccion'          => new sfValidatorPass(array('required' => false)),
      'password'           => new sfValidatorPass(array('required' => false)),
      'login'              => new sfValidatorPass(array('required' => false)),
      'correo_electronico' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('usuario_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Usuario';
  }

  public function getFields()
  {
    return array(
      'id_usuario'         => 'Number',
      'id_tipo_usuario'    => 'ForeignKey',
      'id_entidad'         => 'ForeignKey',
      'nombre_usuario'     => 'Text',
      'ci_usuario'         => 'Text',
      'direccion'          => 'Text',
      'password'           => 'Text',
      'login'              => 'Text',
      'correo_electronico' => 'Text',
    );
  }
}
